import React, {Component} from "react"
import {
    StyleSheet,
    Text,
    View
} from 'react-native'
export default class MainScreen extends React.Component {
    constructor(props) {
        super(props);
        this.state = {
            count: 0
        }
    }

    render() {
        return (
            <View>
                <Text style={{fontSize: 20, backgroundColor: 'red'}}
                      onPress={() => {
                          this.setState({
                              count: this.state.count+1
                          })
                      }}
                >你来打我呀</Text>
                <Text style={{fontSize: 20}}>被打了{this.state.count}次</Text>
            </View>
        )
    }
}